package triangle;

import static org.junit.Assert.*;

import java.io.IOException;

import org.junit.Test;

import triangle.Triangle;

public class TriangleTest {

	@Test
	public void testFind_triangle_type() {
		String s1 = Triangle.find_triangle_type(3, 4, 5);
		assertEquals(s1, "Right Scalene");
		System.out.println("Right Scalen Test Pass");
		
		String scalene1 = Triangle.find_triangle_type(3.3, 4.24, 5.11);
		assertEquals(scalene1, "Scalene");
		System.out.println("Scalen Test Pass");
		
		String isocoles1 = Triangle.find_triangle_type(5, 6, 6);
		assertEquals(isocoles1, "Isoceles");
		System.out.println("Isoceles Test Pass");
		
		String isocoles2 = Triangle.find_triangle_type(6, 6, 5);
		assertEquals(isocoles2, "Isoceles");
		System.out.println("Isoceles Test Pass");
		
		String isocoles3 = Triangle.find_triangle_type(6, 5, 6);
		assertEquals(isocoles3, "Isoceles");
		System.out.println("Isoceles Test Pass");
		
		String equi = Triangle.find_triangle_type(3, 3, 3);
		assertEquals(equi, "Equilateral");
		System.out.println("Equilateral Test Pass");

		String s3 = Triangle.find_triangle_type(50, 48, 14);
		assertEquals(s3, "Right Scalene");
		System.out.println("Right triangle Test Pass");

		String s4 = Triangle.find_triangle_type(5, 13, 12);
		assertEquals(s4, "Right Scalene");
		System.out.println("Right triangle Test Pass");

		String s5 = Triangle.find_triangle_type(3.04, 4, 5);
		assertEquals(s5, "Right Scalene");
		System.out.println("Right triangle Test Pass - 1%");

		String s6 = Triangle.find_triangle_type(2.96, 4, 5);
		assertEquals(s6, "Right Scalene");
		System.out.println("Right triangle Test Pass - 1%");
		
		String s7 = Triangle.find_triangle_type(2.95, 4, 5);
		assertEquals(s7, "Scalene");
		System.out.println("Scalene triangle Test Pass > 1%");
		
		String s8 = Triangle.find_triangle_type(50, 48, 14.8);
		assertEquals(s8, "Right Scalene");
		System.out.println("Right Scalene triangle Test Pass");
		
		String s9 = Triangle.find_triangle_type(50, 48, 13.2);
		assertEquals(s9, "Right Scalene");
		System.out.println("Right Scalene triangle Test Pass");
		
		String s10 = Triangle.find_triangle_type(50, 48, 13);
		assertEquals(s10, "Scalene");
		System.out.println("Scalene triangle Test Pass- >1%");
		
		String s11 = Triangle.find_triangle_type(5, 12.94, 12);
		assertEquals(s11, "Right Scalene");
		System.out.println("Right Scalene triangle Test Pass");
		
		String s12 = Triangle.find_triangle_type(5, 13.06, 12);
		assertEquals(s12, "Right Scalene");
		System.out.println("Right Scalene triangle Test Pass");
		
		String s13 = Triangle.find_triangle_type(5, 13.07, 12);
		assertEquals(s13, "Scalene");
		System.out.println("Scalene triangle Test Pass- >1%");
		
		String s14 = Triangle.find_triangle_type(2.999999, 3, 3);
		assertEquals(s14, "Isoceles");
		System.out.println("Isoceles triangle Test Pass");
		
		String s15 = Triangle.find_triangle_type(5, 6, 6.0000001);
		assertEquals(s15, "Scalene");
		System.out.println("Scalene triangle Test Pass");

		String s16 = Triangle.find_triangle_type(6, 6.0000001, 5);
		assertEquals(s16, "Scalene");
		System.out.println("Scalene triangle Test Pass");

		String s17 = Triangle.find_triangle_type(6.0000001, 5, 6);
		assertEquals(s17, "Scalene");
		System.out.println("Scalene triangle Test Pass");

	}

	@Test
	public void testIs_right_triangle() {
		
			boolean test_right_triangle1 = Triangle.is_right_triangle(3, 4, 5);
			assertTrue(test_right_triangle1);			
			System.out.println("Right triangle Test Pass");

	}
	
	@Test
	public void testisTriangle() {
		
			boolean test_is_triangle1 = Triangle.isTriangle(1, 2, 3);
			assertFalse(test_is_triangle1);			
			System.out.println("Not a triangle Pass");
			
			boolean test_is_triangle2 = Triangle.isTriangle(3, 1, 2);
			assertFalse(test_is_triangle2);			
			System.out.println("Not a Triangle Pass");
			
			boolean test_is_triangle3 = Triangle.isTriangle(1, 3, 2);
			assertFalse(test_is_triangle3);			
			System.out.println("Not a Triangle Pass");
			
			boolean test_is_triangle4 = Triangle.isTriangle(3, 4, 5);
			assertTrue(test_is_triangle4);			
			System.out.println("Is Triangle Pass");
			
			boolean test_is_triangle5 = Triangle.isTriangle(1.000001, 2, 3);
			assertTrue(test_is_triangle5);			
			System.out.println("Not a Triangle Pass");
			
			boolean test_is_triangle6 = Triangle.isTriangle(3, 1.000001, 2);
			assertTrue(test_is_triangle6);			
			System.out.println("Not a Triangle Pass");
			
			boolean test_is_triangle7 = Triangle.isTriangle(1, 3.000001, 2);
			assertFalse(test_is_triangle7);			
			System.out.println("Not a Triangle Pass");
			
			boolean test_is_triangle8 = Triangle.isTriangle(0.999999, 2, 3);
			assertFalse(test_is_triangle8);			
			System.out.println("Not a Triangle Pass");
			
			boolean test_is_triangle9 = Triangle.isTriangle(3, 0.999999, 2);
			assertFalse(test_is_triangle9);			
			System.out.println("Not a Triangle Pass");
			
			boolean test_is_triangle10 = Triangle.isTriangle(1, 2.999999, 2);
			assertTrue(test_is_triangle10);			
			System.out.println("Not a Triangle Pass");
	}
	
	@Test
	public void testreadSide() {
		
			double readSide1 = Triangle.readSide("4.0");
			assertEquals("ReadSideFail", readSide1, 4.0, 0.001);
			System.out.println("Read Side Pass");
			
			double readSide2 = Triangle.readSide("5");
			assertEquals("ReadSideFail",  readSide2,5, 0.001);
			System.out.println("Read Side Pass");
			
					
	} 
	
	@Test
	public void testrestart() {
		
			boolean r1 = Triangle.restart("Y");
			assertTrue("RestartFail", r1);
			System.out.println("Restart True Pass");
			
			boolean r2 = Triangle.restart("N");
			assertFalse("RestartFail", r2);
			System.out.println("Restart False Pass");
			
					
	} 

}